package org.cloud.shop.gateway.security;


import org.springframework.security.authentication.encoding.Md5PasswordEncoder;
import org.springframework.security.crypto.password.PasswordEncoder;
import org.springframework.stereotype.Component;

@Component
public class MyPasswordEncoder implements PasswordEncoder {

	public static String SALT="123456";

	@Override
	public String encode(CharSequence rawPassword) {
		Md5PasswordEncoder encoder = new Md5PasswordEncoder();
		return encoder.encodePassword((String) rawPassword, SALT);
	}

	@Override
	public boolean matches(CharSequence rawPassword, String encodedPassword) {
		Md5PasswordEncoder encoder = new Md5PasswordEncoder();
		return encoder.isPasswordValid(encodedPassword, (String) rawPassword, SALT);
	}


	
	

}
